extends layout

block content
  include includes/navbar.pug
  h1 图片分享
  .row
    .col-12.col-md-8
      .card.m-1
        h3.card-title 图片上传
        .card-body
          if user
            form(action="/images/", method="post", enctype="multipart/form-data")
              .form-group.row
                label.col-sm-2 浏览
                input.col-sm-10.form-control-file(type='file',name='imgfile')
              .form-group.row
                label.col-sm-2 标题
                input.col-sm-8.form-control(type='text', name='title')
              .form-group.row
                label.col-sm-2 描述
                input.col-sm-8.form-control(type='text', name='description')
              .form-group.row
                input.col-sm-10.form-control-file(type='hidden',name='imgUser',value=`${user.nickname}`,id='hiddenValue') 
              .form-group.row
                .offset-md-8.col-sm-2
                  button.btn.btn-primary.btn-block(type='submit') 提交
    .col-12.col-md-4
      include includes/stats.pug  
  .row
    .col-12.col-md-8
      .row
        each image in images
          .col-6.col-md-4
            a(href=`/images/show/${image._id}`)
              .card
                img.card-img-top(src=`/uploads/${image.diskfilename}`, alt=image.description)
                .card-body
                  p.card-text= image.title
    .col-12.col-md-4
      include includes/recent.pug 
  if user
    script(src="/javascripts/show2.js")  